<?php
/**
 * Created by PhpStorm.
 * User: 魏爷
 * Date: 2016/6/6
 * Time: 21:19
 */

namespace Admin\Model;


class ForumManageModel extends BaseModel
{
    // 数据表名（不包含表前缀）
    protected $tableName        =   'feel';

    /**
     * 根据ID查询信息
     * @return array()
    **/
    public function getByIdForumInfo($feel_id){
        return $this->where("feel_id=$feel_id")->find();
    }
    /**
     * 禁用标题
     * @return boolean
    **/
    public function forumDel($feel_id){
        $res=$this->where("feel_id=$feel_id")->setField('feel_del',2);
        return $res==false?false:true;
    }
    /**
     * 恢复标题
     * @return boolean
     **/
    public function forumRec($feel_id){
        $res=$this->where("feel_id=$feel_id")->setField('feel_del',1);
        return $res==false?false:true;
    }
    /**
     * 根据条件查询信息
     * @return array()
    **/
    public function getForumInfo($feel_title,$feel_del){
        $where=array();
        if(!empty($feel_title)){
            $where['feel_title']=$feel_title;
        }
        if(!empty($feel_del)){
            $where['feel_del']=$feel_del;
        }
        $where['feel_status']=1;
        return $this->where($where)->order('feel_id DESC')->select();
    }
}